package com.jibei.mendo.utils;

import android.content.Context;
import android.content.Intent;

/**
 * Created by lhl on 2019/8/31.
 * 状态栏和导航栏的工具类
 */
public class StatusAndNavigationBarUtil {

    private Intent intent = new Intent();

    private StatusAndNavigationBarUtil() {
    }

    public static StatusAndNavigationBarUtil getInstance() {
        return StatusAndNavigationBarUtil.Holder.instance;
    }

    private static class Holder {
        private static final StatusAndNavigationBarUtil instance = new StatusAndNavigationBarUtil();
    }

    /**
     * 显示状态栏
     *
     * @param mContext 上下文
     */
    public void showStatusBar(Context mContext) {
        intent.setAction("ACTION_STATUSBAR_DROPDOWN");
        intent.putExtra("cmd", "show");
        mContext.sendBroadcast(intent, null);
    }

    /**
     * 隐藏状态栏
     *
     * @param mContext 上下文
     */
    public void hideStatusBar(Context mContext) {
        intent.setAction("ACTION_STATUSBAR_DROPDOWN");
        intent.putExtra("cmd", "hide");
        mContext.sendBroadcast(intent, null);
    }

    /**
     * 显示导航栏
     *
     * @param mContext 上下文
     */
    public void showNavigationBar(Context mContext) {
        intent.setAction("ACTION_SHOW_NAVBAR");
        intent.putExtra("cmd", "show");
        mContext.sendBroadcast(intent, null);
    }

    /**
     * 隐藏导航栏
     *
     * @param mContext 上下文
     */
    public void hideNavigationBar(Context mContext) {
        intent.setAction("ACTION_SHOW_NAVBAR");
        intent.putExtra("cmd", "hide");
        mContext.sendBroadcast(intent, null);
    }
}
